public class VarParameter {
    public static void main(String[] args) {
        HspMethod m = new HspMethod();
        System.out.println(m.sum(1,2,3,4,5,6,7,8,9,10));
    }
}
class HspMethod{
    //可变参数
    public int sum(int... nums){
        int res = 0;
        for(int i = 0;i < nums.length;i++){
            res += nums[i];
        }
        return res;
    }
}